package com.gxa.insurance.mapper;

import com.gxa.insurance.pojo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author Min
 */
public interface OrderMapper {
    List<Order> selectAllOrderList();

    /**
     * 查询所有订单类型
     *
     * @return
     */
    List<Order> selectAllOrder(Map<String, Integer> map);

    /**
     * 查询所有未还车订单类型
     *
     * @return
     */
    List<Order> selectNotReturnedOrder();

    /**
     * 查询所有订单类型
     *
     * @return
     */
    List<OrderType> selectAllOrderType();

    /**
     * 查询所有订单来源
     *
     * @return
     */
    List<OrderSource> selectAllSource();

    /**
     * 查询所有订单状态
     *
     * @return
     */
    List<OrderStatus> selectAllStatus();

    /**
     * 返回订单模糊查询
     *
     * @return
     */
    List<Order> selectByLike(Map map);

    Integer selectByfLikeCount(Map map);

    /**
     * 创建总订单的方法
     *
     * @param order
     * @return
     */
    Integer addOrderByBackstage(Order order);

    /**
     * 创建初始化易理赔订单
     *
     * @return
     */
    Integer addInitInsuranceOrder(InsuranceOrder insuranceOrder);

    /**
     * 创建初始化检测订单
     *
     * @return
     */
    Integer addInitInspectOrder(InspectOrder inspectOrder);

    /**
     * 穿件初始化领标订单
     *
     * @return
     */
    Integer addInitBringTheOrder(BringTheOrder bringTheOrder);

    /**
     * 创建初始化新车订单
     *
     * @return
     */
    Integer addInitNewCarOrder(NewCarOrder newCarOrder);

    /**
     * 创建初始化异地委托函订单
     *
     * @return
     */
    Integer addInitRemoteOrder(RemoteOrder remoteOrder);

    Integer selectAllOrderCount();

    List<Integer> selectStatus(String orderStatus);

    Integer updateOrderStatus(Integer statusId, Integer id);

    List<Order> selectByNumber(String orderNumber);

    /**
     * 批量删除id
     *
     * @param id
     */
    void deleteOrders(List<Integer> id);

    String selectOrderTypeById(Integer id);

    void deletePays(List<Integer> payId);

    Integer selectPayIdByOrderId(Integer id);

    void deleteInsuranceByOrderId(Integer id);

    void deleteInspectByOrderId(Integer id);

    void deleteBringTheByOrderId(Integer id);

    void deleteNewCarByOrderId(Integer id);

    void deleteRemoteByORderId(Integer id);

    Order selectOrderByNumber(String number);

    InsuranceOrder selectInsuranceByOrderId(Integer id);

    void updateOrder(Order dbOrder);

    void updateInsurance(InsuranceOrder dbInOrder);

    void insertDamageImage(@Param("id") Integer id, @Param("path") String damagePath);

    void insertAttachmentImage(@Param("id") Integer id, @Param("path") String attachmentPath);

    InspectOrder seleInspectByORderId(Integer id);

    BringTheOrder selectBringTheOrderByOrderId(Integer id);

    NewCarOrder selectNewCarByOrderId(Integer id);

    RemoteOrder selectRemoteByORderId(Integer id);

    OrderStatus selectOrderStatus(String orderStatus);

    List<Image> selectDamageImgByOrderId(Integer id);

    List<Image> selectAttachmentImgByOrderId(Integer id);

    Pay selectPayByOrderId(Integer id);

    Integer updateNewCarOrderTotalOrder(Order order);

    List<Map<String, Object>> getOrderByTypeInsurance();

    List<Map<String, Object>> getOrderByTypeInspect();

    List<Map<String, Object>> getOrderByTypeBring();

    List<Map<String, Object>> getOrderByTypeNewCar();

    List<Map<String, Object>> getOrderByTypeRemote();

    InspectOrder selectInspectOrder(Integer id);

    void updateInspectOrder(InspectOrder inspectOrder);

    List<String> selectNumberByDriver(String driver);

    Integer updateOrderStatusByNumber(@Param("number") String number, @Param("orderStatus") String orderStatus);
    //司机端订单详情
    List<Order>selectOrderDetails(Integer id);
}
